from django.contrib.auth.models import Group
from rest_framework.decorators import action
from rest_framework.response import Response
from rest_framework.viewsets import ModelViewSet

from meiduo_admin.serializer.admin import AdminSerializer
from meiduo_admin.serializer.group import GroupSerializer
from meiduo_admin.utils import UserPageNum
from users.models import User


class AdminView(ModelViewSet):
    serializer_class = AdminSerializer
    # 获取管理员用户
    queryset = User.objects.filter(is_staff=True)
    pagination_class = UserPageNum


    def simple(self,request):
        sprc = Group.objects.all()
        ser = GroupSerializer(sprc,many=True)
        return Response(ser.data)









